* import and clean postcode data from australia post

clear
insheet using OrigData/pc-book_20130513.csv, comma

rename locality suburb
replace suburb = proper(suburb)

keep if state=="VIC"

*identify duplicates (usually post office boxes)
duplicates tag suburb, gen(duplicate_suburb)

tab category, gen(cate)
* keep postcodes that are delivery area not post office boxes
drop if duplicate_suburb>0 & cate1 ~=1

gen dup = (duplicate_suburb==1)*(cate1~=1)

* collapse and identify potential miscoding later
collapse (first) pcode , by(suburb dup)

save Data/postcode_list.dta, replace
